//
//  SIBaseViewController.m
//  CampingLight
//
//  Created by Piccolo on 2017/11/5.
//  Copyright © 2017年 SmartIT. All rights reserved.
//

#import "SIBaseViewController.h"

@interface SIBaseViewController () {
}

@end

@implementation SIBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self adaptIPhoneX];
    [self setupBackGroundImageView];
    [self setupNaviBarTextColor];
    [self hideNaviBar];
//    if ([SIUtil checkPlatformIsFiveType] || [SIUtil checkPlatformIsFourType]) {
//        
//        [SIUtil setCustomView:_imageView transformMakeWidth:375.f / 320.f height:1.f];
//        
//    }
    // Do any additional setup after loading the view.
}

- (void)hideNaviBar {
    self.navigationItem.hidesBackButton = YES;
//    self.navigationController.navigationBar.translucent = YES;
//    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
}

- (void)setupBackGroundImageView {
    if ([SIUtil checkPlatformIsFiveType] || [SIUtil checkPlatformIsFourType]) {
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH / SCREEN_WIDTH_COEFFIENT, SCREEN_HEIGHT / SCREEN_HEIGHT_COEFFIENT)];
    } else {
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    }
    _imageView.image = [UIImage imageNamed:@"背景.png"];
    [self.view insertSubview:_imageView atIndex:0];
}

- (void)setupNaviBarTextColor {
    [self.navigationController.navigationBar setTitleTextAttributes:
     @{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.extendedLayoutIncludesOpaqueBars = YES;
}

- (void)adaptIPhoneX {
    if ([SIUtil checkString:[SIUtil platformString] containSubString:@"iPhone X"]) {
        NSLog(@"@20土豪X");
        for (UIView *subView in self.view.subviews) {
            [subView si_resetWithDeltaX:0 deltaY:DELTA_STATUS_BAR_HEIGHT_OF_IPHONE_X deltaWidth:0 deltaHeight:0];
        }
    }
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
